<template>
  <div class="wrapper" ref="wrapper">
    <div class="content">
      <slot></slot>
    </div>
  </div>
</template>

<script>
import { getHomeMultidata, getHomeGoodsData, getshow } from "@/network/home.js";
import BScroll from "better-scroll";
export default {
  name: "Bscroll",
  data() {
    return {
      scroll: null,
    };
  },
  computed: {},
  watch: {},
  methods: {},
  mounted() {
    this.scroll = new BScroll(this.$refs.wrapper, {
      probeType: 3,
      pullUpLoad: true,
      click: true,
    });
    this.scroll.on("pullingUp", () => {
      // 做些事情
      console.log('上拉加载数据====');
      this.getHomeGoodsData('pop')
      this.scroll.finishPullUp(); // 事情做完，需要调用此方法告诉 better-scroll 数据已加载，否则上拉事件只会执行一次
      this.scroll.refresh()
    });
  },
  methods:{
    getHomeGoodsData(type) {
      // 分类数据（自己的数据）
      const page =3;
      const psum = page * 10;
      getHomeGoodsData(type, psum).then((results) => {
        // result拿到的是一个数组对象
        console.log('查看拿到的数据==',results)
      });
    },
  }
};
</script>

<style scoped>
.wrapper {
  position: absolute;
  left: 0;
  right: 0;
  top: 44px;
  bottom: 49px;
  height: calc(100%-93px);
}
</style>
